//
//  GFDetialModel.m
//  GoodFood
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 荣伟峰. All rights reserved.
//

#import "GFDetialModel.h"

@implementation GFDetialsModel

+ (instancetype)detailsModelWithDintionary:(NSDictionary *)dic {
    GFDetialsModel *detailsModel = [[GFDetialsModel alloc] init];
    
    if ([dic[@"health_light"] isEqual:[NSNull null]]) {
        
        NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:[dic objectForKey:@"calory"], @"calory", [dic objectForKey:@"carbohydrate"], @"carbohydrate", [dic objectForKey:@"fat"], @"fat", @"1", @"health_light", [dic objectForKey:@"is_liquid"], @"is_liquid", [dic objectForKey:@"fiber_dietary"], @"fiber_dietary", [dic objectForKey:@"name"], @"name", [dic objectForKey:@"protein"], @"protein" , [dic objectForKey:@"thumb_image_url"], @"thumb_image_url", [dic objectForKey:@"weight"], @"weight", [dic objectForKey:@"code"], @"code",  nil];
        
        //        NSLog(@"%@", [dictionary objectForKey:@"code"]);
        
        [detailsModel setValuesForKeysWithDictionary:dictionary];
        
    } else {
        
        [detailsModel setValuesForKeysWithDictionary:dic];
    }
    
    return detailsModel;
    
}
@end
